import React, { Component } from 'react';
import Conversation from 'pages/index/pages/project/pages/projectMergeRequestDetail/pages/changes/containers/components/diff/conversation';

import './index.scss';

export default class LogDiff extends Component {
  render() {
    const { log } = this.props;
    const { noteData } = log;
    const firstData = noteData[0];
    const conversation = firstData.noteList.map((item) => {
      if (!item.author) {
        item.author = {
          avatar_url: item.author_avatar_url,
          extern_uid: item.author_extern_uid,
          id: item.author_id,
          name: item.author_name,
          state: item.author_state,
          username: item.author_username,
        };
      }
      return item;
    });
    return (
      <div className="log-detail-common-body">
        <Conversation conversation={conversation} noDraft {...this.props} />
      </div>
    );
  }
}
